package com.yyw.gulimall.product.web;

import com.yyw.gulimall.product.service.SkuInfoService;
import com.yyw.gulimall.product.vo.item.ItemInfoVo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Classname ProductItemWebController
 * @Description 商品详情页请求
 * @Date 2020/12/8 9:48
 * @author yyw
 */
@Controller
@RequestMapping("/item")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ProductItemWebController {

    private final SkuInfoService skuInfoService;

    @GetMapping("/{skuId}")
    public String itmeIndex(@PathVariable String skuId, Model model) {
        ItemInfoVo infoVo = skuInfoService.itemInfoBySkuId(skuId);
        model.addAttribute("skuItem", infoVo);
        return "items";
    }

}
